import React, { Component } from 'react';
import {
    View,
    Text,
    StyleSheet,
    ScrollView
    } from 'react-native';
import {BackToTop} from 'iftide'

export default class Basic extends Component {
    constructor(props){
        super(props)
    }
    backToTopClick = () => {
        return this._scrollView;
    }

    componentDidMount(){
        //this.backToTop._open();
    }
    render(){
        let backToTop = {
            imgStyle:{width:40,height:40},
            clickEvent: this.backToTopClick,
            isShow:true
        }
        return (
            <View>
                <BackToTop {...backToTop} ref={(obj)=>{this.backToTop=obj}}/>
                <ScrollView  ref={(scrollView) => this._scrollView = scrollView}>
                    <Text style={styles.txt}>1</Text>
                    <Text style={styles.txt}>2</Text>
                    <Text style={styles.txt}>3</Text>
                    <Text style={styles.txt}>20</Text>
                </ScrollView>
            </View>
        )
    }
}
const styles = StyleSheet.create({
    txt: {
        textAlign: 'center',
        textAlignVertical: 'center',
        height: 400,
        backgroundColor:'#f3f3f3',
        borderColor: '#9FD567',
        borderWidth:3
    }
});